class Seiso::ImportMaster
  # Author:: Willie Wheeler
  # Copyright:: Copyright (c) 2014-2016 Expedia, Inc.
  # License:: Apache 2.0
  class Mappers::ServiceMapper

    def initialize(resolver)
      @resolver = resolver
    end

    # Maps a document service to a Seiso service.
    #
    # - doc_service : document service
    def map(doc_service, context)
      {
        'key' => doc_service['key'],
        'name' => doc_service['name'],
        'platform' => doc_service['platform'],
        'scmRepository' => doc_service['scmRepository'],
        'group' => @resolver.item_uri('serviceGroups', doc_service['group']),
        'type' => @resolver.item_uri('serviceTypes', doc_service['type']),
        'owner' => @resolver.item_uri('persons', doc_service['owner'])
      }
    end
  end
end
